package io.renren.modules.business.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.business.entity.BusRecruitmentPlanEntity;
import io.renren.modules.business.service.BusRecruitmentPlanService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;

import javax.validation.constraints.Max;


/**
 * 招新计划管理
 *
 * @author liao mengqing
 */
@RestController
@RequestMapping("business/plan")
public class BusRecruitmentPlanController {
    @Autowired
    private BusRecruitmentPlanService busRecruitmentPlanService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:plan:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = busRecruitmentPlanService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("business:plan:save")
    public R save(@RequestBody BusRecruitmentPlanEntity busRecruitmentPlan){
		busRecruitmentPlanService.save(busRecruitmentPlan);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("business:plan:delete")
    public R delete(@RequestBody Long[] ids){
		busRecruitmentPlanService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
